package com.linkage.jz.bankruptcy.bean;

import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;

import java.util.ArrayList;
import java.util.List;

/**
 * @author AFAP
 * 讨论参与的人员
 */
public class TalkPerson {

    private String id; // id


    public String getCreditorId() {
        return creditorId;
    }

    public void setCreditorId(String creditorId) {
        this.creditorId = creditorId;
    }

    private String creditorId; // id
    private String username; // 用户名
    private String avatar; // 头像
    private double confirmAmount; // 确认金额
    private boolean kindGuarantee; //  债权种类-担保优先
    private boolean kindTax; // 债权种类-税务
    private boolean kindOrdinary; // 债权种类-普通
    private boolean kindOther; // 债权种类-其他
    private boolean banned; // 禁言

    public boolean selected = false;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public double getConfirmAmount() {
        return confirmAmount;
    }

    public void setConfirmAmount(double confirmAmount) {
        this.confirmAmount = confirmAmount;
    }

    public boolean isKindGuarantee() {
        return kindGuarantee;
    }

    public void setKindGuarantee(boolean kindGuarantee) {
        this.kindGuarantee = kindGuarantee;
    }

    public boolean isKindTax() {
        return kindTax;
    }

    public void setKindTax(boolean kindTax) {
        this.kindTax = kindTax;
    }

    public boolean isKindOrdinary() {
        return kindOrdinary;
    }

    public void setKindOrdinary(boolean kindOrdinary) {
        this.kindOrdinary = kindOrdinary;
    }

    public boolean isKindOther() {
        return kindOther;
    }

    public void setKindOther(boolean kindOther) {
        this.kindOther = kindOther;
    }

    public boolean isBanned() {
        return banned;
    }

    public void setBanned(boolean banned) {
        this.banned = banned;
    }

    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    @Override
    public String toString() {
        return "DiscussionPerson{" +
                "id='" + id + '\'' +
                "creditorId='" + creditorId + '\'' +
                ", username='" + username + '\'' +
                ", avatar='" + avatar + '\'' +
                ", confirmAmount=" + confirmAmount +
                ", kindGuarantee=" + kindGuarantee +
                ", kindTax=" + kindTax +
                ", kindOrdinary=" + kindOrdinary +
                ", kindOther=" + kindOther +
                ", banned=" + banned +
                '}';
    }

    public static List<TalkPerson> parse(JsonArray arr) {
        List<TalkPerson> list = new ArrayList<>();
        for (int i = 0; i < arr.size(); i++) {
            list.add(parse(arr.get(i).getAsJsonObject()));
        }
        return list;
    }

    private static TalkPerson parse(JsonObject obj) {
        TalkPerson bean = new Gson().fromJson(obj, TalkPerson.class);
        return bean;
    }
}
